﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Program06
{
    class Discount
    {
        #region 需求
        //有些商品是单价打折
        //有些是总价满减
        //有些是第二个半价
        //……
        #endregion

        private Sale Sale { get; set; }
        
        //打折率
        private double _folding;
        public double Folding
        {
            get { return _folding; }
            set { _folding = value < 0 ? 0 : value; }
        }

        public Discount() { }
        public Discount(Sale sale)
        {
            this.Sale = sale;
        }

        /// <summary>
        /// 传入一个商品的单价，计算打折后的单价
        /// </summary>
        /// <param name="price"></param>
        public void DisFolding(double price)
        {
            Sale = new Sale(price * Folding) { Count = Sale.Count };
            Console.WriteLine(Sale);
        }
    }
}
